@tailwind base;
@tailwind components;
@tailwind utilities;
@import 'splitpanes/dist/splitpanes.css';

/* 禁用题目页卡片的悬停缩放效果 */
.no-scale-cards .hover\:scale-105:hover {
  --tw-scale-x: 1 !important;
  --tw-scale-y: 1 !important;
}

/* 全局基础样式 */
@layer base {
  html {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
    font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
    font-variation-settings: normal;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }
  
  body {
    @apply text-gray-900 bg-gray-50;
    font-size: 14px;
    line-height: 1.6;
    letter-spacing: -0.01em;
  }
  
  /* 响应式字体大小 */
  @media (max-width: 640px) {
    body {
      font-size: 13px;
    }
  }
  
  @media (min-width: 1024px) {
    body {
      font-size: 15px;
    }
  }
  
  /* 统一字体大小 */
  h1, h2, h3, h4, h5, h6 {
    font-family: inherit;
    font-weight: 600;
    line-height: 1.25;
    letter-spacing: -0.025em;
  }
  
  h1 {
    @apply text-3xl;
  }
  
  h2 {
    @apply text-2xl;
  }
  
  h3 {
    @apply text-xl;
  }
  
  h4 {
    @apply text-lg;
  }
  
  h5 {
    @apply text-base;
  }
  
  h6 {
    @apply text-sm;
  }
  
  /* 统一按钮字体 */
  button {
    font-family: inherit;
    font-weight: 500;
    letter-spacing: -0.01em;
  }
  
  /* 统一输入框字体 */
  input, textarea, select {
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
  }
  
  /* 统一代码字体 */
  code, pre, .font-mono {
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', 'Monaco', 'Courier New', monospace;
    font-feature-settings: 'liga' 1, 'calt' 1;
  }
  
  /* 滚动条样式 */
  ::-webkit-scrollbar {
    width: 6px;
    height: 6px;
  }
  
  ::-webkit-scrollbar-track {
    @apply bg-gray-100;
  }
  
  ::-webkit-scrollbar-thumb {
    @apply bg-gray-400 rounded-full;
  }
  
  ::-webkit-scrollbar-thumb:hover {
    @apply bg-gray-500;
  }
}

/* 组件样式 */
@layer components {
  /* 按钮样式 */
  .btn {
    @apply inline-flex items-center justify-center px-4 py-2 border border-transparent text-sm font-medium rounded-lg shadow-sm transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2 disabled:opacity-50 disabled:cursor-not-allowed;
    font-family: inherit;
    font-weight: 500;
    letter-spacing: -0.01em;
  }
  
  .btn-primary {
    @apply btn bg-primary-500 text-white hover:bg-primary-600 focus:ring-primary-500;
  }
  
  .btn-secondary {
    @apply btn bg-gray-500 text-white hover:bg-gray-600 focus:ring-gray-500;
  }
  
  .btn-outline {
    @apply btn bg-white text-gray-700 border-gray-300 hover:bg-gray-50 focus:ring-primary-500;
  }
  
  .btn-danger {
    @apply btn bg-red-500 text-white hover:bg-red-600 focus:ring-red-500;
  }
  
  /* 输入框样式 */
  .input {
    @apply block w-full px-3 py-2 border border-gray-300 rounded-lg shadow-sm placeholder-gray-400 focus:outline-none focus:ring-primary-500 focus:border-primary-500 sm:text-sm;
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
  }
  
  .input-error {
    @apply input border-red-300 text-red-900 placeholder-red-300 focus:ring-red-500 focus:border-red-500;
  }
  
  /* 卡片样式 */
  .card {
    @apply bg-white rounded-lg shadow-sm border border-gray-200;
  }
  
  .card-hover {
    @apply card transition-all duration-200 hover:shadow-md hover:-translate-y-1;
  }
  
  /* 标签样式 */
  .tag {
    @apply inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium;
    font-family: inherit;
    font-weight: 500;
    letter-spacing: -0.01em;
  }
  
  .tag-primary {
    @apply tag bg-primary-100 text-primary-800;
  }
  
  .tag-success {
    @apply tag bg-green-100 text-green-800;
  }
  
  .tag-warning {
    @apply tag bg-yellow-100 text-yellow-800;
  }
  
  .tag-error {
    @apply tag bg-red-100 text-red-800;
  }
  
  /* 难度标签样式 */
  .difficulty-easy {
    @apply tag bg-green-100 text-green-800 border border-green-200;
  }
  
  .difficulty-medium {
    @apply tag bg-yellow-100 text-yellow-800 border border-yellow-200;
  }
  
  .difficulty-hard {
    @apply tag bg-red-100 text-red-800 border border-red-200;
  }
  
  /* 状态标签样式 */
  .status-accepted {
    @apply tag bg-green-100 text-green-800;
  }
  
  .status-wrong {
    @apply tag bg-red-100 text-red-800;
  }
  
  .status-pending {
    @apply tag bg-gray-100 text-gray-800;
  }
  
  /* 代码编辑器样式 */
  .monaco-editor {
    @apply rounded-lg border border-gray-300;
  }
}

/* 工具样式 */
@layer utilities {
  /* 动画样式 */
  .animate-fade-in {
    animation: fadeIn 0.3s ease-in-out;
  }
  
  .animate-slide-up {
    animation: slideUp 0.3s ease-out;
  }
  
  .animate-slide-down {
    animation: slideDown 0.3s ease-out;
  }
  
  .animate-slide-left {
    animation: slideLeft 0.3s ease-out;
  }
  
  .animate-slide-right {
    animation: slideRight 0.3s ease-out;
  }
  
  .animate-scale-in {
    animation: scaleIn 0.3s ease-out;
  }
  
  .animate-bounce {
    animation: bounce 1s infinite;
  }
  
  .animate-float {
    animation: float 3s ease-in-out infinite;
  }
  
  .animate-glow {
    animation: glow 2s ease-in-out infinite;
  }
  
  .animate-shimmer {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200px 100%;
    animation: shimmer 1.5s infinite;
  }
  
  .animate-blob {
    animation: blob 7s infinite;
  }
  
  .animate-pulse-slow {
    animation: pulse 3s cubic-bezier(0.4, 0, 0.6, 1) infinite;
  }
  
  /* 动画延迟 */
  .animation-delay-100 {
    animation-delay: 0.1s;
  }
  
  .animation-delay-200 {
    animation-delay: 0.2s;
  }
  
  .animation-delay-300 {
    animation-delay: 0.3s;
  }
  
  .animation-delay-500 {
    animation-delay: 0.5s;
  }
  
  .animation-delay-1000 {
    animation-delay: 1s;
  }
  
  .animation-delay-2000 {
    animation-delay: 2s;
  }
  
  .animation-delay-4000 {
    animation-delay: 4s;
  }
  
  /* 文本截断 */
  .text-ellipsis {
    @apply truncate;
  }
  
  .text-ellipsis-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  
  .text-ellipsis-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  
  /* 加载状态 */
  .loading {
    @apply relative overflow-hidden;
  }
  
  .loading::after {
    content: '';
    @apply absolute top-0 left-0 w-full h-full bg-gradient-to-r from-transparent via-white to-transparent opacity-50;
    animation: loading 1.5s infinite;
  }
  
  /* 骨架屏 */
  .skeleton {
    @apply bg-gray-200 rounded animate-pulse;
  }
  
  /* 图片占位符 */
  .image-placeholder {
    @apply bg-gray-200 flex items-center justify-center;
  }
  
  /* 无数据状态 */
  .empty-state {
    @apply flex flex-col items-center justify-center text-center text-gray-500;
  }
}

/* 动画关键帧 */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideLeft {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideRight {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes bounce {
  0%, 20%, 53%, 80%, 100% {
    transform: translate3d(0, 0, 0);
  }
  40%, 43% {
    transform: translate3d(0, -8px, 0);
  }
  70% {
    transform: translate3d(0, -4px, 0);
  }
  90% {
    transform: translate3d(0, -2px, 0);
  }
}

@keyframes float {
  0%, 100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-10px);
  }
}

@keyframes glow {
  0%, 100% {
    box-shadow: 0 0 5px rgba(59, 130, 246, 0.5);
  }
  50% {
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.8), 0 0 30px rgba(59, 130, 246, 0.6);
  }
}

@keyframes shimmer {
  0% {
    background-position: -200px 0;
  }
  100% {
    background-position: calc(200px + 100%) 0;
  }
}

@keyframes loading {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

@keyframes blob {
  0% {
    transform: translate(0px, 0px) scale(1);
  }
  33% {
    transform: translate(30px, -50px) scale(1.1);
  }
  66% {
    transform: translate(-20px, 20px) scale(0.9);
  }
  100% {
    transform: translate(0px, 0px) scale(1);
  }
}

/* Toast 自定义样式 */
.Vue-Toastification__toast {
  @apply rounded-lg;
}

.Vue-Toastification__toast--success {
  @apply bg-green-500;
}

.Vue-Toastification__toast--error {
  @apply bg-red-500;
}

.Vue-Toastification__toast--warning {
  @apply bg-yellow-500;
}

.Vue-Toastification__toast--info {
  @apply bg-blue-500;
}

/* 响应式工具 */
@media (max-width: 640px) {
  .mobile-full-width {
    @apply w-full;
  }
}

/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
  .dark {
    @apply bg-gray-900 text-white;
  }
  
  .dark .card {
    @apply bg-gray-800 border-gray-700;
  }
  
  .dark .input {
    @apply bg-gray-800 border-gray-600 text-white placeholder-gray-400;
  }
  
  .dark .btn-outline {
    @apply bg-gray-800 text-gray-300 border-gray-600 hover:bg-gray-700;
  }
}

/* 打印样式 */
@media print {
  .no-print {
    display: none !important;
  }
  
  .print-break {
    page-break-before: always;
  }
}

/* 响应式工具类 */
@layer utilities {
  /* 响应式容器 */
  .container-responsive {
    @apply w-full mx-auto px-4 sm:px-6 lg:px-8;
    max-width: 1280px;
  }
  
  /* 响应式网格 */
  .grid-responsive {
    @apply grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4 sm:gap-6;
  }
  
  /* 响应式文本 */
  .text-responsive {
    @apply text-sm sm:text-base lg:text-lg;
  }
  
  .heading-responsive {
    @apply text-xl sm:text-2xl lg:text-3xl xl:text-4xl;
  }
  
  /* 响应式间距 */
  .spacing-responsive {
    @apply py-4 sm:py-6 lg:py-8;
  }
  
  .spacing-x-responsive {
    @apply px-4 sm:px-6 lg:px-8;
  }
  
  /* 响应式按钮组 */
  .btn-group-responsive {
    @apply flex flex-col sm:flex-row gap-2 sm:gap-3;
  }
  
  /* 响应式卡片 */
  .card-responsive {
    @apply p-4 sm:p-6 lg:p-8;
  }
  
  /* 移动端优化 */
  @media (max-width: 640px) {
    .mobile-optimized {
      @apply text-sm leading-relaxed;
    }
    
    .mobile-full-width {
      @apply w-full;
    }
    
    .mobile-stack {
      @apply flex-col space-y-2 space-x-0;
    }
  }
  
  /* 平板端优化 */
  @media (min-width: 641px) and (max-width: 1024px) {
    .tablet-optimized {
      @apply text-base;
    }
  }
  
  /* 桌面端优化 */
  @media (min-width: 1025px) {
    .desktop-optimized {
      @apply text-lg;
    }
  }
}


